local skel = fk.CreateSkill {
  name = "rmt__woshi",
  tags = {Skill.Lord},
}

Fk:loadTranslationTable{
  ["rmt__woshi"] = "我视",
  [":rmt__woshi"] = "主公技，（当你需要使用或打出【杀】时）你可以令一名其他角色选择是否使用或打出一张【杀】（视为由你使用或打出），若为周势力角色，此【杀】视为红色。",

  ["#rmt__woshi"] = "我视：先选【杀】目标，再请求一名其他角色出【杀】",
  ["#rmt__woshi-choose"] = "我视：请求一名其他角色代替你出【杀】",
  ["#rmt__woshi-slash"] = "我视：你可以代替 %src 出【杀】",

  ["$rmt__woshi1"] = "抚我则后，虐我则仇；独夫作威，予必往之。",
  ["$rmt__woshi2"] = "受有夷人亿万，予有乱臣十人，唯一心，胜亿万心。",
}

skel:addEffect("viewas", {
  anim_type = "offensive",
  pattern = "slash",
  prompt = "#rmt__woshi",
  card_filter = Util.FalseFunc,
  view_as = function(self)
    local c = Fk:cloneCard("slash")
    c.skillName = skel.name
    return c
  end,
  before_use = function(self, player, use)
    local room = player.room
    local targets = room:getOtherPlayers(player, false)
    if #targets == 0 then return "" end
    local tos = room:askToChoosePlayers(player, {
      targets = targets, min_num = 1, max_num = 1, skill_name = skel.name, prompt = "#rmt__woshi-choose", cancelable = false
    })
    local to = tos[1]
    local response = room:askToResponse(to, {
      skill_name = skel.name, pattern = "slash", prompt = "#rmt__woshi-slash:"..player.id, cancelable = true
    })
    if response then
      local slash_ask = response.card
      response.skipDrop = true
      room:responseCard(response)
      if to.kingdom == "zhou" then
        -- 战报还是显示黑色
        local new_slash = Fk:cloneCard(slash_ask.name)
        new_slash:addSubcards(room:getSubcardsByRule(slash_ask, {Card.Processing}) )
        new_slash.color = Card.Red
        slash_ask = new_slash
      end
      use.card = slash_ask
    else
      return skel.name
    end
  end,
  enabled_at_play = function(self, player)
    return table.find(Fk:currentRoom().alive_players, function (p)
      return p ~= player
    end) ~= nil
  end,
  enabled_at_response = function (self, player, response)
    return table.find(Fk:currentRoom().alive_players, function (p)
      return p ~= player
    end) ~= nil
  end,
})

return skel
